import os
from os.path import join

from Autotests.BaseTest import AirClientTestCase
from Autotests.LocalMachine.Pages.AirClient.OptionsPage.LocalSpeedKickTab import SpeedKickType
from Autotests.LocalMachine.Pages.AirClient.OptionsPage.LocalSpeedKickTab import LocalSpeedKickTab
from Common.Helpers import FileSystemHelper


class OptionsLocalSpeedKickTest(AirClientTestCase):
    def setUp(self):
        super(OptionsLocalSpeedKickTest, self).setUp()
        self.fsHelper = FileSystemHelper()
        self.localSpeedkickTab = LocalSpeedKickTab()
        self.speedKickPath = join(os.getcwd(), "LSK_Tests")
        self.speedKickType = SpeedKickType.local

    def test_SetLocalDriveOptions(self):
        self.fsHelper.recreateFolder(self.speedKickPath)
        self.localSpeedkickTab.enableLskLocalSettings(self.speedKickPath, self.speedKickType)
        lskSettings = self.localSpeedkickTab.getLskSettings()

        self.assertEqual(True, lskSettings[0], "Checkbox 'Enable Local SpeedKick' state was set incorrectly")
        self.assertEqual(self.speedKickType, lskSettings[1], "Local drive type was set incorrectly")
        self.assertEqual(self.speedKickPath.lower(), lskSettings[2].lower(), "LskLocation was set incorrectly")


    def tearDownImpl(self):
        self.localSpeedkickTab.disableLskSettings()
        self.fsHelper.deleteFolder(self.speedKickPath)

import unittest
if __name__ == "__main__":
    unittest.main()
